package org.example.common.http.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindException;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Slf4j
//@RestControllerAdvice
public class AdviceConfig {

    @ExceptionHandler(Throwable.class)
    public Object handleThrowable(Throwable e){
        log.error("", e);
        return "unCatchError";

    }

    @ExceptionHandler(BindException.class)
    public Object handleBindException(BindException e){
        log.error("", e);
        return e.getMessage();

    }


}
